package com.gitee.feizns.web.dao.handler.meta;

import com.gitee.feizns.bean.Property;
import com.gitee.feizns.web.dao.handler.meta.annotation.EncodingBase64;
import com.gitee.feizns.web.utils.EncryptUtils;

/**
 * @author feizns
 * @since 2019/9/16
 */
public class EncodingAutoHandler extends AbstractGeneralFillInputHandler {

    @Override
    protected void handle(Property<Object, Object> prop, Object original) {
        String val;
        if ( prop.isAnnotationPresent(EncodingBase64.class) && (val = prop.val(String.class)) != null )
            prop.set(EncryptUtils.base64Encode(val));
    }

}
